#pragma once
#ifndef WEBENGINEVIEW_H
#define WEBENGINEVIEW_H

#include <qglobal.h>
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
#include <QEvent>
#include <QWebEngineView>
#include <QOpenGLWidget>
#include <QPointer>


/// 继承自QWebEngineView，解决触屏地图手势操作问题\n
class WebEngineView : public QWebEngineView
{
    Q_OBJECT

public:
    WebEngineView(QWidget *parent = nullptr);

    void SetArrowToolMode(bool isArrowTool)
    {
        m_bIsArrowTool = isArrowTool;
    }

Q_SIGNALS:
    void EventTransit(QEvent *);

protected:
    virtual QWebEngineView *createWindow(QWebEnginePage::WebWindowType type) override;
    virtual bool event(QEvent *ev) override;
    virtual bool eventFilter(QObject *obj, QEvent *ev) override;


private:
    bool m_bIsArrowTool{ true };
    QPointer<QOpenGLWidget> child_;
};

#endif
#endif // WEBENGINEVIEW_H



